In a heat engine or heat pump, a heat exchanger may be employed to transfer heat between a thermal storage material and a working fluid for use with turbomachinery. The heat engine may be reversible, e.g., it may also be a heat pump, and the working fluid and heat exchanger may be used to transfer heat or cold to thermal storage media.